window.onload=function(){
    var oDiv=document.getElementById('sorc');
    var oBox=oDiv.getElementsByClassName('part-1');    
    var oUl=document.getElementById('uls');
    var oLi=oUl.getElementsByTagName('a');
    var oQ=document.getElementById('q');
    
    for (var i = 0; i < oLi.length; i++) {
        oLi[i].index = i;
        oLi[i].onclick = function() {
          
          for(var i = 0; i < oLi.length; i++) {
            oLi[i].className = "";
            oBox[i].style.display = "none";
          }
          this.className="active";
          oBox[this.index].style.display = 'block';
          oQ.innerHTML=oLi[this.index].innerText;
          if(this.index==5){
            map(0);
          }
        };
      
     }


     // 地图的复选框
      
        var oMap=document.getElementById('map');
        var oMapli=oMap.getElementsByTagName('li');
        var oMapimg=oMap.getElementsByTagName('img');
   
        for(var j=0;j<oMapli.length;j++){
          oMapli[j].index=j;
          oMapli[j].onclick=function(){
            for(var j=0;j<oMapli.length;j++){
             oMapimg[j].style.display='none';
            }
           oMapimg[this.index].style.display='block';
           map(this.index);
         };
        }
      
        //地图第一次加载在为oBox[5].style.display='block'的时候；
  
      
      function map(type) {
           
        var myIcon = new BMap.Icon("img/About/contactsbj.png?v=fbad4cbada", new BMap.Size(94,42));
        var map = new BMap.Map("mapA");
        var point=new BMap.Point(116.404, 39.915);
      
          if(type==0){
            point = new BMap.Point(116.404, 40.915);
          }else if(type==1){
            point = new BMap.Point(121.487899486,31.24916171);
            myIcon = new BMap.Icon("img/About/contactssh.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==2){
            point = new BMap.Point(113.307649675,24.1200491021);
            myIcon = new BMap.Icon("img/About/contactsgz.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==3){
            point = new BMap.Point(114.025973657,22.5460535462);
            myIcon = new BMap.Icon("img/About/contactssz.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==4){
            point = new BMap.Point(106.530635013,29.5446061089);
            myIcon = new BMap.Icon("img/About/contactscq.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==5){
            point = new BMap.Point(112.979352788,28.2134782309);
            myIcon = new BMap.Icon("img/About/contactscs.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==6){
            point = new BMap.Point(114.316200103,30.5810841269);
            myIcon = new BMap.Icon("img/About/contactswh.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==7){
            point = new BMap.Point(108.953098279,34.2777998978);
            myIcon = new BMap.Icon("img/About/contactsxa.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==8){
            point = new BMap.Point(120.219375416,30.2592444615);
            myIcon = new BMap.Icon("img/About/contactshz.png?v=fbad4cbada", new BMap.Size(94,42));
          }else if(type==9){
            point = new BMap.Point(104.067923463,30.6799428454);
            myIcon = new BMap.Icon("img/About/contactscd.png?v=fbad4cbada", new BMap.Size(94,42));
          }
          
          map.centerAndZoom(point, 5);
          var marker2 = new BMap.Marker(point,{icon:myIcon, offset : new BMap.Size(0, -20) });  
          map.addOverlay(marker2);  
      }

      var oDl=document.getElementById('category');
      var oDd=oDl.getElementsByTagName('dd'); 
      for(var i=0;i<oDd.length;i++){
        oDd[i].index=i;
        oDd[i].onclick=function(){
          for(var i=0;i<oDd.length;i++){
            oDd[i].className='';
          }
          this.className="active-bg";
          // alert(1)
        };
      }

      //
      window.onscroll=function(){
        var  oTt=document.getElementById('tt');
        var scrolltop = document.documentElement.scrollTop || document.body.scrollTop; //滚轮事件

        if(scrolltop >= 600){
          oTt.style.position='fixed';
          oTt.style.top='0';
        }else{
          oTt.style.position='';
        }
      };
   
      

    
};